package com.five.calendar.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.five.calendar.common.database.BaseDatabaseHelper;
import com.five.calendar.database.table.ScheduleTable;
import com.five.calendar.database.table.TargetDayTable;
import com.five.calendar.database.table.TargetTable;

/**
 * Created by xin on 2017/8/29.
 */

public class DataHelper extends BaseDatabaseHelper {
    public DataHelper(Context context){
        super(context, "calendar", 1);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        try {
            db.beginTransaction();
            db.execSQL(ScheduleTable.SQL);
            db.execSQL(TargetTable.SQL);
            db.execSQL(TargetDayTable.SQL);
            db.setTransactionSuccessful();
        } catch (Exception e){
            e.printStackTrace();
        } finally {
            db.endTransaction();
        }
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
